package com.cloudDemoOrder.service;

import entity.Product;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * @author Daft_V
 * @date 2022/5/6 19:25
 */
@FeignClient(value = "server-product")
public interface ProductFeignService {

    /**
     * 更新商品库存
     *
     * @param pid    商品id
     * @param number 订单数量
     * @return Boolean
     */
    @PostMapping("/product/updateStock")
    Boolean updateStock(@RequestParam("pid") int pid, @RequestParam("number") int number);

    /**
     * 根据商品id查询商品信息
     *
     * @param id 商品id
     * @return Product
     */
    @GetMapping("/product/queryProductById")
    Product queryProductById(@RequestParam("id") int id);

}
